package com.itany.corejava.code08_常用类.内部类;

/**
 * @author 石小俊
 * 2024年07月23日 16:40
 */
public class Test04_匿名内部类 {
    public static void main(String[] args) {
        SomeInterface some = new SomeClass();
        some.doSome();

        SomeInterface someInterface = new SomeInterface() {
            @Override
            public void doSome() {
                System.out.println("Test04_匿名内部类.doSome");
            }
        };
        someInterface.doSome();

        OtherClass otherClass = new OtherClass() {
            @Override
            public void doOther() {
                System.out.println("Test04_匿名内部类.doOther");
            }
        };
        otherClass.doOther();
    }

}

interface SomeInterface{
    void doSome();
}
class SomeClass implements SomeInterface{

    @Override
    public void doSome() {
        System.out.println("SomeClass.doSome");
    }
}

abstract class OtherClass{
    public abstract void doOther();
}
class SonClass extends OtherClass{

    @Override
    public void doOther() {
        System.out.println("SonClass.doOther");
    }
}
